package com.candy.collection;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Set;
import java.util.TreeMap;

public class MapTest {
    public static void main(String[] args) {
        test03();
    }
    public static void test03() {
        TreeMap mp=new TreeMap();
        mp.put("name","zhangsan");
        mp.put("name","lisi");
        mp.put("age",21);
        mp.put("sex",true);
//        mp.put(null,null);
//        取出所有的key值组成的Set集合
        Set se=mp.keySet();
        for (Object ob:se){
            System.out.println("key:"+ob+";value:"+mp.get(ob));
        }

    }
    public static void test02() {
        LinkedHashMap mp=new LinkedHashMap();
        mp.put("name","zhangsan");
        mp.put("name","lisi");
        mp.put("age",21);
        mp.put("sex",true);
        mp.put(null,null);
//        取出所有的key值组成的Set集合
        Set se=mp.keySet();
        for (Object ob:se){
            System.out.println("key:"+ob+";value:"+mp.get(ob));
        }




    }
    public static void test01() {
        HashMap mp=new HashMap();
        mp.put("name","zhangsan");
        mp.put("name","lisi");
        mp.put("age",21);
        mp.put("sex",true);
        mp.put(null,null);
//        取出所有的key值组成的Set集合
        Set se=mp.keySet();
        for (Object ob:se){
            System.out.println("key:"+ob+";value:"+mp.get(ob));
        }




    }
}
